home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / toNativePath.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.1 KB  |  63 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18.  
  19. //<doc>
  20.  
  21. //<name toNativePath>
  22.  
  23. //<owner "Alias|Wavefront Unsupported">
  24.  
  25. //<synopsis>
  26.  
  27. //    string toNativePath( string )
  28.  
  29. //<keywords>
  30.  
  31. //        MEL NT path file
  32.  
  33. //
  34.  
  35. //<description>
  36.  
  37. //        Convert from '/' to '\\' path formats on NT, otherwise does nothing.
  38.  
  39. //        Use this proceedure to convert pathnames retrieved from Maya to
  40.  
  41. //        more NT-like backslash-separated pathnames (note that most NT
  42.  
  43. //        system calls do handle forward slashes as path-delimiters).
  44.  
  45. //
  46.  
  47. //<flags>
  48.  
  49. //      string $path
  50.  
  51. //          The path to be converted.
  52.  
  53. //
  54.  
  55. //<examples>
  56.  
  57. //      // Find a file in a subdirectory of the current one
  58.  
  59. //      string $file = `workspace -q -fn`;
  60.  
  61. //        // Result: D:/Projects/projectOne/scene2 // On NT
  62.  
  63. //        // Result: /usr/guest/maya/projects/projectOne/scene2 // On IRIX
  64.  
  65. //      string $path = toNativePath( $file );
  66.  
  67. //        // Result: D:\Projects\projectOne\scene2 // On NT
  68.  
  69. //        // Result: /usr/guest/maya/projects/projectOne/scene2 // On IRIX
  70.  
  71. //
  72.  
  73. //<returns>
  74.  
  75. //      string: The converted path.
  76.  
  77. //</doc>
  78.  
  79. //
  80.  
  81. global proc string toNativePath ( string $strFile )
  82.  
  83. {
  84.  
  85.     if( `about -nt` )
  86.  
  87.     {
  88.  
  89.         string $strNew;
  90.  
  91.         do
  92.  
  93.         {
  94.  
  95.             $strNew = $strFile;
  96.  
  97.             $strFile = substitute ("/", $strNew, "\\");
  98.  
  99.         }
  100.  
  101.         while ($strNew != $strFile);
  102.  
  103.     }
  104.  
  105.     return $strFile;
  106.  
  107. }
  108.  
  109.